<template>
    <div class = 'switch-layout-wrapper'> 
		<component v-for = "widget in widgetList" 
			:is = "widget" 
			:key = "widget.id" 
			:style = "widget.positionStyle" 
		>
		</component>  
    </div>
</template>

<script>
import BaseLayoutWidget from '@/jimu/BaseLayoutWidget.js'
export default {
	name: 'SwitchLayoutWidget',
	mixins:[ BaseLayoutWidget ],
	components: {
		
	},
	data () {
		return {
		
		}
	},

	methods:{
		/*重载基类创建子组件方法 */
		_createWidgets: function(){
			for(let i=0; i < this.widgets.length; i++){
				if(this.widgets[i].on){
					this._addWidget(this.widgets[i])
					return // 只创建第一个状态on:true的子组件
				}
			}
		},
		/* 重载基类打开组件方法 */
		_openWidget: function(widgetName){
			let config = this._getConfig(widgetName)
			if(!this._hasWidget(widgetName) && config){
				this.widgetList = []
				this._addWidget(config)
			}
		}
	}
}
</script>

<style lang="scss">

</style>